/**
 * 
 */
package com.axt.dbaudit.unitTest;
import java.util.List;
import com.axt.dbaudit.model.TargetDB;
import com.axt.dbaudit.bean.TargetDBBean;

/**
 * @author Administrator
 *
 */
public class SoaTargetDB
{

	/**
	 * 测试添加审计服务器
	 */
	void testAddTarget(){
		TargetDB oTargetDB = new TargetDB();
		oTargetDB.setAu_IP("192.168.1.99");
		oTargetDB.setAu_DBType("Oracle");
		oTargetDB.setAu_Name("99_Oracle");
		oTargetDB.setAu_port("1521");
		oTargetDB.setAu_Otherport("http:80");
	    oTargetDB.setAu_Deleted(0);
		oTargetDB.setAu_isEnable(1);
		boolean bRet = false;
		bRet = new TargetDBBean().AddTargetDB(oTargetDB);
		if (bRet)
		{
			System.out.println("添加审计服务器成功！");
		}
	}
	void testQueryTargerDb()
	{
		List<TargetDB> oTargetDBList = null;
		oTargetDBList = new TargetDBBean().getTargetDBList();
		if (oTargetDBList != null){
			System.out.println("获取审计服务器成功！");
			System.out.println("共有审计服务器:" + oTargetDBList.size() + "个");
		}
	}
	void testUpdateTargetDB()
	{
		TargetDB oTargetDB = new TargetDB();
		oTargetDB.setAu_IP("192.168.1.123");
		oTargetDB.setAu_DBType("Oracle");
		oTargetDB.setAu_Name("123_Oracle");
		oTargetDB.setAu_port("1521");
		oTargetDB.setAu_Otherport("http:80");
	    oTargetDB.setAu_Deleted(0);
		oTargetDB.setAu_isEnable(1);	
		oTargetDB.setAu_ServerID("1");
		boolean bRet = false;
		bRet = new TargetDBBean().UpdateTargerDB(oTargetDB);
		if (bRet)
		{
			System.out.println("更新审计服务器成功！");
		}		
	}
	void testDeleteTargetDB()
	{
		boolean bRet = false;
		bRet = new TargetDBBean().DeleteTargetDB("1");
		if (bRet)
		{
			System.out.println("删除审计服务器成功！");
		}			
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception
	{
		new SoaTargetDB().testQueryTargerDb();
		new SoaTargetDB().testAddTarget();
		new SoaTargetDB().testQueryTargerDb();
		new SoaTargetDB().testUpdateTargetDB();
		new SoaTargetDB().testQueryTargerDb();
		new SoaTargetDB().testDeleteTargetDB();
		new SoaTargetDB().testQueryTargerDb();
	}

}
